﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace LabAss6
{
    public partial class CurrencyConverter : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnConvert_Click(object sender, EventArgs e)
        {
           
            // 汇率：1 人民币 = 0.15 美元
            const double exchangeRate = 0.15;

            if (double.TryParse(lblResult.Text, out double rmb))
            {
                double usd = rmb * exchangeRate;
                lblResult.Text = $"{rmb} 人民币 = {usd:F2} 美元"; // 保留两位小数
            }
            else
            {
                lblResult.Text = "请输入有效的数字！";
                lblResult.ForeColor = System.Drawing.Color.Red;
            
        }
    }
    }
}